let logger = require("pomelo-logger").getLogger(__filename);

class DealRule{
    static dealCard(gameTable){
        for (let player of gameTable.getAllPlayers()) {
            for (let j = 0; j < 13; j++) {
                let card = gameTable.popFirstCard();
                player.addCardInHand(card);
            }
            logger.info(`发牌成功,playerUid:${player.getUid()},tableId:${gameTable.getTid()},玩家当前手牌:${player.cardsInHand}`);
        }
        for (let player of gameTable.getAllPlayers()) {
            // 庄家开始多抓一张
            if (player.getUid() === gameTable.getDealerUid()) {
                let cardGrab = gameTable.popFirstCard();
                player.setCardGrab(cardGrab, 1);
                player.moCardNum = 1;// 庄家默认已经摸了一张
            }
        }
    }
}

module.exports = DealRule;